home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 3
/
Cream of the Crop 3.iso
/
clipper
/
ks94an.zip
/
SNATCH.HDR
< prev
next >
Wrap
Text File
|
1994-04-25
|
2KB
|
56 lines
/******************************************************************************
The Klipper Library, for CA-Clipper 5.x
Copyright (c), 1994, Wallace Information Systems Engineering
FUNCTION:
_Snatch( cInStr, nLowBound, nHighBound ) --> cString
PARAMETERS:
cInStr : string to extract from
nLowBound : Low position number
nHighBound : high position number
SHORT:
A modified SUBSTR() with absolute from/to params rather than from/len.
DESCRIPTION:
_Snatch() returns a string between two positions rather than between a
start/offset (as with substr()).
It is a useful alternative to substr() where you must supply a start position
and a number of characters. When you are not sure where the substr is or how
long it is, you can use _Snatch() in conjunction with _nth_occr(), at(),
etc, to get the substr even when you do not know it's exact placement within
the string.
NOTE:
EXAMPLE:
t = _snatch('ABCDEFGHIJ',5,10)
Result: t = 'EFGHIJ'
When the exact placement of the string is unknown, but a set of
delimiting characters IS known:
string1 = 'Dear <FNAME>, Howdy!'
string2 = 'Greetings <FULLNAME>'
t1 = _Snatch(string1,at('<',string1)+1,at('>',string1)-1)
t2 = _Snatch(string2,at('<',string1)+1,at('>',string1)-1)
Result: t1 = "FNAME"
t2 = "FULLNAME"
Note that in this example, the same _Snatch() syntax extracts the text
delimited by <> even though the desired texts were of different lengths and
began at different positions.
******************************************************************************/